@class CQChatRoomController;
@class CQDirectChatController;
@class MVChatConnection;
@class MVChatRoom;
@class MVChatUser;
@class MVDirectChatConnection;

@interface CQConnectionsController : NSObject {
	@private
	NSMutableArray *_connections;
	NSMutableArray *_connectionCells;

	BOOL _showingConnections;
	BOOL _newConnection;

	NSTimer *_connectTimeUpdateTimer;

	UIView *_mainView;
	UITransitionView *_transitionView;
	UINavigationBar *_navigationBar;

	UITable *_connectionsTable;
	UIPreferencesTable *_settingsTable;

	MVChatConnection *_editingConnection;

	UIPreferencesControlTableCell *_autoConnectCell;
	UIPreferencesTextTableCell *_serverCell;
	UIPreferencesTextTableCell *_serverPortCell;
	UIPreferencesControlTableCell *_sslCell;
	UIPreferencesTextTableCell *_nicknameCell;
	UIPreferencesTextTableCell *_nicknamePasswordCell;
	UIPreferencesTextTableCell *_alternateNicknamesCell;
	UIPreferencesTextTableCell *_usernameCell;
	UIPreferencesTextTableCell *_serverPasswordCell;
	UIPreferencesTextTableCell *_realNameCell;
	UIPreferencesTextTableCell *_autoRoomsCell;
}
+ (CQConnectionsController *) defaultController;

- (void) showConnections;
- (void) hideConnections;

- (NSArray *) allConnections;
- (NSArray *) connectedConnections;
- (MVChatConnection *) connectionForServerAddress:(NSString *) address;
- (NSArray *) connectionsForServerAddress:(NSString *) address;
- (BOOL) managesConnection:(MVChatConnection *) connection;

- (void) addConnection:(MVChatConnection *) connection;
- (void) insertConnection:(MVChatConnection *) connection atIndex:(unsigned) index;
- (void) removeConnection:(MVChatConnection *) connection;
- (void) removeConnectionAtIndex:(unsigned) index;
- (void) replaceConnectionAtIndex:(unsigned) index withConnection:(MVChatConnection *) connection;
@end
